﻿using Himp.Base;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;

namespace Himp.Erp.EntityFrameworkCore;

[ConnectionStringName(ErpDbProperties.ConnectionStringName)]
public class ErpDbContext : AbpDbContext<ErpDbContext>, IErpDbContext
{
    /// <summary>
    /// 
    /// </summary>
    public DbSet<BizSeq> BizSeqs { get; set; }

    #region 物资基本信息

    /// <summary>
    /// 物料信息
    /// </summary>
    public DbSet<MatlInfo> MatlInfoes { get; set; }

    /// <summary>
    /// 物料供应商
    /// </summary>
    public DbSet<MatlSpler> MatlSplers { get; set; }

    /// <summary>
    /// 物料仓储
    /// </summary>
    public DbSet<MatlWhse> MatlWhses { get; set; }

    #endregion

    #region 进销存

    /// <summary>
    /// 入库记录
    /// </summary>
    public DbSet<InvChgType> InvChgTypes { get; set; }

    /// <summary>
    /// 入库记录
    /// </summary>
    public DbSet<InboundRec> InboundRecs { get; set; }

    /// <summary>
    /// 入库明细
    /// </summary>
    public DbSet<InboundDetl> InboundDetls { get; set; }

    /// <summary>
    /// 物资库存
    /// </summary>
    public DbSet<MatlInv> MatlInvs { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public DbSet<MaterialAppyRec> MaterialAppyRecs { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public DbSet<MaterialAppyDetl> MaterialAppyDetls { get; set; }

    /// <summary>
    /// 出库记录
    /// </summary>
    public DbSet<OutboundRec> OutboundRecs { get; set; }

    /// <summary>
    /// 出库明细
    /// </summary>
    public DbSet<OutboundDetl> OutboundDetls { get; set; }

    #endregion

    #region 药品

    public DbSet<DrugCatalogAssocChrgitmType> DrugCatalogAssocChrgitmTypes { get; set; }

    public DbSet<DrugCatalog> DrugCatalogs { get; set; }

    public DbSet<DrugCatalogExt> DrugCatalogExts { get; set; }

    public DbSet<DrugCatalogGrant> DrugCatalogGrants { get; set; }

    public DbSet<DrugCatalogType> DrugCatalogTypes { get; set; }

    public DbSet<DrugPrdr> DrugPrdrs { get; set; }

    #endregion

    public ErpDbContext(DbContextOptions<ErpDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.ConfigureErp();
    }
}
